const fs = require('fs');
const path = require('path');

// 需要创建的目录
const directories = [
  'public',
  'public/uploads',
  'public/uploads/posts',
  'public/uploads/avatars',
  'public/images',
  'public/images/activities',
  'public/images/challenges'
];

// 创建目录函数
function createDirectories() {
  directories.forEach(dir => {
    const fullPath = path.join(__dirname, '..', dir);
    if (!fs.existsSync(fullPath)) {
      fs.mkdirSync(fullPath, { recursive: true });
      console.log(`创建目录: ${fullPath}`);
    } else {
      console.log(`目录已存在: ${fullPath}`);
    }
  });
}

// 执行创建
createDirectories(); 